package com.cskaoyan.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 类<code>Doc</code>用于：TODO
 *
 * @author Acher
 * @version 1.0
 * @date 2021-10-18
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseRespVo<T> {

     private long errno;
     private T data;
     private String errmsg;

    public static BaseRespVo ok(Object data) {
        return new BaseRespVo<>(0, data, "成功");
    }

    public static BaseRespVo ok() {
        return new BaseRespVo<>(0, null, "成功");
    }

    public static BaseRespVo error() {
        return new BaseRespVo<>(500, null, "失败");
    }

    public static BaseRespVo error(String errorMsg) {
        return new BaseRespVo<>(500, null, errorMsg);
    }

    public static BaseRespVo permissionError() {
        return new BaseRespVo<>(506, null, "权限不足，请充值");
    }

    public static BaseRespVo permissionError(String errorMsg) {
        return new BaseRespVo<>(506, null, errorMsg);
    }
}
